﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.ServiceProcess;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace EasyWindowsServiceManager.Forms
{
    public partial class ListDevicesServices : Form
    {
        public ListDevicesServices()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            GetAllDevices();
        }


        private void GetAllDevices()
        {

            foreach (ServiceController device in ServiceController.GetDevices())
            {

                string name = device.ServiceName;

                string displayName = device.DisplayName;

                string type = device.ServiceType.ToString();

                string status = device.Status.ToString();



                listBox1.Items.Add(name + "  " + displayName +

                    type + " " + status);

            }

        }
    }
}
